Dynomotion

Group: DynoMotion Message: 6786 From: Jing Zhang Date: 2/21/2013
Subject: Example SimpleCoordMotion doesn't work
Hi, Tom,

I am learning to use KFLOP and KSTEP, and I found that I only make the stepper motors move once with the SimpleCoordMotion example.
I only changed the values for the motor setting, which are highlighted. With that change, the system only worked once.
I could use another program to control the kflop and kstep with no problem. Please help. 

Thanks.
Best

Jing
The codes are as follows:
int main(int argc, char* argv[])
{
KM = new CKMotionDLL(0);  // create as board 0
CM = new CCoordMotion(KM);
int ctpin=10000;
double vel=0.1;
double accl=4.0;

MOTION_PARAMS *p=CM->GetMotionParams();

p->BreakAngle = 30;
p->MaxAccelX = accl;
p->MaxAccelY = accl;
p->MaxAccelZ = accl;
p->MaxAccelA = accl;
p->MaxAccelB = accl;
p->MaxAccelC = accl;
p->MaxVelX = vel;
p->MaxVelY = vel;
p->MaxVelZ = vel;
p->MaxVelA = vel;
p->MaxVelB = vel;
p->MaxVelC = vel;
p->CountsPerInchX = ctpin;
p->CountsPerInchY = ctpin;
p->CountsPerInchZ = ctpin;
p->CountsPerInchA = ctpin;
p->CountsPerInchB = ctpin;
p->CountsPerInchC = ctpin;
CM->SetAbort();
CM->ClearAbort();

CM->SetStraightTraverseCallback(StraightTraverseCallback);
CM->SetStraightFeedCallback(StraightFeedCallback);
CM->SetArcFeedCallback(ArcFeedCallback);

double Speed = 0.2; //inch/sec
double edge=0.2;

CM->StraightTraverse(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);  // jump back to zero
    
// set a bit, move in a circle, clear a bit

CM->DoKMotionBufCmd("SetBitBuf0");
    CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.5000, 0.0000, 0.2500, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
    CM->ArcFeed(Speed,CANON_PLANE_XY,0.0000, 0.0000, 0.0000, 0.2500, DIR_CCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
CM->DoKMotionBufCmd("ClearBitBuf0");
// move in an xy square (0,0) -> (0,0.5) -> (0.5,0.5) -> (0.5,0) -> (0,0)

//CM->StraightFeed(Speed, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
//CM->StraightFeed(Speed, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,0.0, edge, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,edge, edge, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,edge, 0.0, 0.0, 0.0, 0, 0);
CM->StraightFeed(Speed, 0.0,0.0,0.0, 0.0, 0.0, 0.0, 0, 0);

// turn on a bit, wait 2 seconds, turn the bit off
CM->DoKMotionBufCmd("SetBitBuf0");
CM->Dwell(2);
CM->DoKMotionBufCmd("ClearBitBuf0");
CM->FlushSegments();
return 0;
}
Group: DynoMotion Message: 6788 From: Tom Kerekes Date: 2/21/2013
Subject: Re: Example SimpleCoordMotion doesn't work
Hi Jing,

It seems to work ok for me.

What do you mean it only worked once?

You are moving 4 coordinated axes X,Y,Z,A.  The example assumes the axes are already configured, enabled, and an appropriate Coordinate System Defined.

Do you have:

    DefineCoordSystem(0,1,2,3);

in your C initialization?

Regards
TK


Group: DynoMotion Message: 6790 From: Jing Zhang Date: 2/21/2013
Subject: Re: Example SimpleCoordMotion doesn't work
Hi, Tom,

"DefineCoordSystem(0,1,2,3);" is initialized.
I watched that using debug, and found that before "ArcFeed" and "StraightFeed", the value of m_abort is true.
The moving functions are not executed. 
Is that the reason?
Best

Jing

Group: DynoMotion Message: 6791 From: Jing Zhang Date: 2/21/2013
Subject: Re: Example SimpleCoordMotion doesn't work
Hi, Tom,

I forgot to mention that after I changed the value in highlighted places, the program ran once and were driving the steppers.
The other morning, it did not work again.

Best
Jing

Group: DynoMotion Message: 6792 From: Tom Kerekes Date: 2/21/2013
Subject: Re: Example SimpleCoordMotion doesn't work
Hi Jing,

Yes if something causes an Abort then there will be no motion.

Maybe an axis is disabled?  You can run KMotion.exe at the same time and check the enables on the Axis Screen.

Also if you build all the debug libraries (BuildAllLibs.sln) you can step into the code and see what is causing the Abort to be set.

Regards
TK

Group: DynoMotion Message: 6793 From: Jing Zhang Date: 2/21/2013
Subject: Re: Example SimpleCoordMotion doesn't work
Hi, Tom,

Thanks a lot.
I will check the cause of abort.

Best
Jing